ifeq ($(strip $(DEVKITPPC)),)
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
endif

CFLAGS		:= -mcpu=750 -meabi -mhard-float
CC 			:= $(DEVKITPPC)/bin/powerpc-eabi-gcc
OBJCOPY		:= $(DEVKITPPC)/bin/powerpc-eabi-objcopy
OBJDUMP		:= $(DEVKITPPC)/bin/powerpc-eabi-objdump
DEST_DIR	:= "C:/Users/yami/Documents/Dolphin Emulator/Wii/title/00010000/5233354a/data"


hook := hook.bin

all:hook.bin extend.bin
	cp extend.bin $(DEST_DIR)
	cp hook.txt $(DEST_DIR)

hook.bin:hack_game.elf
	$(OBJCOPY) -O binary $< $@

extend.bin:extend.elf
	$(OBJCOPY) -O binary $< $@

#该地址为对话文本的处理程序
hack_game.elf:hack_game.c
	$(CC) $(CFLAGS) -nostdlib $< -O3 -o $@ -Thack_game.ld

#扩展的程序
extend.elf:extend2.c
	$(CC) $(CFLAGS) -nostdlib $< -O2 -Wl,-Map,elf.map,--start-group,-lc,-lgcc,-lsysbase,--end-group -o $@ -Textend.ld
